package com.springBoot.springBootSysCore.modules.controller.api.system;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.springBoot.springBootSysCore.common.utils.returnUtil.PageUtils;
import com.springBoot.springBootSysCore.modules.controller.web.base.BaseController;
import com.springBoot.springBootSysCore.modules.entity.system.SysFaq;
import com.springBoot.springBootSysCore.modules.entity.system.SysIntro;
import com.springBoot.springBootSysCore.modules.enums.base.DeleteStateEnum;
import com.springBoot.springBootSysCore.modules.services.system.SysFaqService;
import com.springBoot.springBootSysCore.modules.services.system.SysIntroService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 *常见问题列表
 */
@RestController
@RequestMapping("${apiPath}/auth/sysFaq")
public class SysFaqControllerApi extends BaseController<SysFaq,String> {
    @Autowired
    private SysFaqService sysFaqService;

    @RequestMapping(value="queryByPage",method= RequestMethod.POST)
    public Object queryByPage(HttpServletRequest request,
                              @RequestParam(required = false ,defaultValue = "1")int pageNumber,
                              @RequestParam(required = false ,defaultValue = "10")int pageSize,
                              SysFaq entity,
                              Model model) throws JsonProcessingException{
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("EQ_delFlag", DeleteStateEnum.NO_DELETE.getVal());
        return super.queryByPageForJson(pageNumber,pageSize,model, request,map, "createDate", "desc");
    }
}
